<template>
    <div class="container formCon">
      <div class="container pt-4">
        <div class="row">
          <div class="col-12">
            <div class="pointsRule">
              <ul id="list">
                <li style="z-index:6;background-image: linear-gradient(to right, #005bea ,#00c6fb)" class="green" @click="gotoHome()"><a><span>首页</span><i style="background-color:#00c6fb"></i></a></li>
                <li style="z-index:5;background-color:#ffc107;"><a><em class="before"></em><span  style="color: #4e555b;">费用报销</span><i style="background-color:#ffc107;"></i></a></li>
              </ul>
            </div>
          </div>
        </div>
      </div>
      <div class="row justify-content-center mt-5 ">
        <div class="col-6 formInner">
          <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="公司">
              <el-select v-model="form.company" placeholder="请选择公司名称">
                <el-option label="书吧" value="shanghai"></el-option>
                <el-option label="农场" value="beijing"></el-option>
                <el-option label="投资公司" value="tz"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="类别">
              <el-select v-model="form.type" placeholder="请选择报销类别">
                <el-option label="人工费用" value="shanghai"></el-option>
                <el-option label="固定费用" value="beijing"></el-option>
                <el-option label="变动费用" value="bf"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="科目">
              <el-select v-model="form.region" placeholder="请选择报销科目">
                <el-option label="员工工资" value="shanghai"></el-option>
                <el-option label="职工福利费" value="beijing"></el-option>
                <el-option label="社会保险费" value="bn"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="票面科目">
              <el-input type="text" v-model="form.desc"></el-input>
            </el-form-item>
            <el-form-item label="实际科目">
              <el-input type="text" v-model="form.desc"></el-input>
            </el-form-item>
            <el-form-item label="金额">
              <el-input type="text" v-model="form.desc"></el-input>
            </el-form-item>
            <el-form-item label="报销人">
              <el-input type="text" v-model="form.desc"></el-input>
            </el-form-item>
            <el-form-item label="上传发票">
              <el-upload
                class="upload-demo"
                action="https://jsonplaceholder.typicode.com/posts/"
                :on-preview="handlePreview"
                :on-remove="handleRemove"
                :before-remove="beforeRemove"
                multiple
                :limit="3"
                :on-exceed="handleExceed"
                :file-list="fileList">
                <el-button size="small" >点击上传</el-button>
                <!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>-->
              </el-upload>
            </el-form-item>
            <el-form-item>
              <el-button type="success" size="small" @click="onSubmit">确定</el-button>
            </el-form-item>

          </el-form>

        </div>
      </div>
    </div>
</template>

<script>
    export default {
        name: "formComponent",
      data() {
        return {
          form: {
            company: '',
            type: '',
            delivery: false,
            type: [],
            resource: '',
            desc: '',
            fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]
          }
        }
      },
      methods: {
        gotoHome(){
          this.$router.push("/index")
        },
        onSubmit() {
          console.log('submit!');
        },
        handleRemove(file, fileList) {
          console.log(file, fileList);
        },
        handlePreview(file) {
          console.log(file);
        },
        handleExceed(files, fileList) {
          this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
        },
        beforeRemove(file, fileList) {
          return this.$confirm(`确定移除 ${ file.name }？`);
        }
      }
    }
</script>

<style scoped>
 .formCon{
   height: 100%;
 }
  .formInner{
    box-shadow: 0 0 10px #dfe4ed;
    margin: 1rem;
    padding: 2rem;
  }
</style>
